<template>
  <div class="loading-state" :class="{ 'loading-state-compact': compact }">
    <el-icon class="loading-icon" :size="iconSize">
      <Loading />
    </el-icon>
    <p v-if="text" class="loading-text">{{ text }}</p>
  </div>
</template>

<script>
import { Loading } from '@element-plus/icons-vue'

export default {
  name: 'LoadingState',
  components: {
    Loading,
  },
  props: {
    text: {
      type: String,
      default: '加载中...',
    },
    iconSize: {
      type: [Number, String],
      default: 32,
    },
    compact: {
      type: Boolean,
      default: false,
    },
  },
}
</script>

<style scoped>
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--spacing-xl, 32px);
}

.loading-state-compact {
  min-height: 100px;
  padding: var(--spacing-md, 16px);
}

.loading-icon {
  color: var(--nanchang-red, #C8102E);
  animation: rotate 1s linear infinite;
}

.loading-text {
  margin: var(--spacing-md, 16px) 0 0 0;
  font-size: clamp(13px, 2vw, 14px);
  color: var(--text-secondary, #606266);
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .loading-state {
    min-height: 150px;
    padding: var(--spacing-lg, 24px);
  }

  .loading-state-compact {
    min-height: 80px;
    padding: var(--spacing-sm, 8px);
  }
}
</style>


